package connectors;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.net.Socket;

/**
 * @author Lucas 'Mezmor' Pfister, Vishal Patel
 *
 */
public abstract class Connection {
	
	Socket socketConnector;
	PrintWriter outgoing;
	BufferedReader incoming;
	
	public boolean tearDown(){
		try {
			outgoing.close();
			incoming.close();
			socketConnector.close();
		} catch (IOException e) {
			e.printStackTrace();
			return false;
		}
		return true;
	}
	
	public void send(String data){
		outgoing.println(data);
	}
	
	public String receive(){
		String data = null;
		try {
			data = incoming.readLine();
		} catch (IOException e) {
			e.printStackTrace();
		}
		return data;
	}
}